/**
 * 
 */
package org.gov.vis.master.gui;

import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;

import org.gov.vis.components.VISComboBoxModel;
import org.gov.vis.components.VISTextField;
import org.gov.vis.gui.VisBaseDialog;
import org.gov.vis.gui.util.GuiUtil;
import org.gov.vis.master.gui.listener.EditStaffListener;
import org.gov.vis.util.DBConstants;
import org.gov.vis.util.Util;

import com.toedter.calendar.JDateChooser;

/**
 * @author user
 *
 */
public class EditStaffDialog extends VisBaseDialog{



	/**
	 * 
	 */
	private static final long serialVersionUID = 3108575575867221387L;

	private JPanel jPanel1;
	private JButton btnSave;
	private VISTextField txtFldFatherName;
	private VISTextField txtFldDOB;
	private JLabel lblDateOfBirth;
	private JLabel lblQualification;
	private VISTextField txtFldDistrict;
	private JLabel lblEmpType;
	private JPanel pnlMessage;
	private JComboBox combxEmployeeType;
	private VISTextField txtFldMandal;
	private JLabel lblDistrict;
	private VISTextField txtFldVillage;
	private JLabel lblMandal;
	private JLabel lblVillage;
	private VISTextField txtFldDesignaton;
	private JLabel lblDateOfJoin;
	private JLabel lblDesignation;
	private VISTextField txtFldQualification;
	private String searchText;

	private JLabel lblFatherName;
	private VISTextField txtFldName;
	private VISTextField txtFldCode;
	private JButton btnReset;
	private JPanel btnStaffPanel;
	private JLabel lblName;
	private JLabel lblCode;

	private VISComboBoxModel visComBoxModel;

	private JDateChooser dtChoDateOfJoin;

	private JDateChooser dtChoDateOfBirth;
	private Object hidnObject;

	public EditStaffDialog(Frame owner, String title, boolean modal) {
		super(owner, title, modal);
		// TODO Auto-generated constructor stub
		initGUI();
		GuiUtil.CompCenterCords cords=GuiUtil.getCompCenterCords(550, 650);
		setBounds(cords.getX(), cords.getY(), 550, 650);
		this.setSize(550, 650);
	}

	private void initGUI() {


		GridBagLayout thisLayout = new GridBagLayout();
		thisLayout.rowWeights = new double[] {0.1};
		thisLayout.rowHeights = new int[] {7};
		thisLayout.columnWeights = new double[] {0.1};
		thisLayout.columnWidths = new int[] {7};
		getContentPane().setLayout(thisLayout);
		{
			jPanel1 = new JPanel();
			GridBagLayout jPanel1Layout = new GridBagLayout();
			jPanel1Layout.columnWidths = new int[] {7, 7, 7, 7, 7};
			jPanel1Layout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7};
			jPanel1Layout.columnWeights = new double[] {0.0, 0.0, 0.0, 0.1, 0.0};
			jPanel1Layout.rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
			getContentPane().add(jPanel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
			jPanel1.setLayout(jPanel1Layout);
			{
				lblCode = new JLabel();
				jPanel1.add(lblCode, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
				lblCode.setText(setFieldLabel(getResources().getString("dialog_label_staff_code"), true));
			}
			{
				lblName = new JLabel();
				jPanel1.add(lblName, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
				lblName.setText(setFieldLabel(getResources().getString("dialog_label_staff_name"), true));
			}
			{
				btnStaffPanel = new JPanel();
				jPanel1.add(btnStaffPanel, new GridBagConstraints(3, 24, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
				{
					btnSave = new JButton();
					btnStaffPanel.add(btnSave);
					btnSave.setText(getResources().getString("dialog_button_update"));
				btnSave.addActionListener(new EditStaffListener(this));
				}
				{
					btnReset = new JButton();
					btnStaffPanel.add(btnReset);
					btnReset.setText(getResources().getString("dialog_button_delete"));
					btnReset.addActionListener(new EditStaffListener(this));
				}
			}
			{
				txtFldCode = new VISTextField();
				jPanel1.add(txtFldCode, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
			}
			{
				txtFldName = new VISTextField();
				jPanel1.add(txtFldName, new GridBagConstraints(3, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
			}
			{
				lblFatherName = new JLabel();
				jPanel1.add(lblFatherName, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
				lblFatherName.setText(setFieldLabel(getResources().getString("dialog_label_staff_fathername"), true));
			}
			{
				txtFldFatherName = new VISTextField();
				jPanel1.add(txtFldFatherName, new GridBagConstraints(3, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
			}
			{
				lblDateOfBirth = new JLabel();
				jPanel1.add(lblDateOfBirth, new GridBagConstraints(1, 8, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
				lblDateOfBirth.setText(setFieldLabel(getResources().getString("dialog_label_staff_dob"), true));
			}
			{
				//txtFldDOB = new VISTextField();
					dtChoDateOfBirth = new JDateChooser(null,DBConstants.DISPLAY_DATE_FORMAT);
					dtChoDateOfBirth.setPreferredSize(txtFldFatherName.getPreferredSize());
				jPanel1.add(dtChoDateOfBirth, new GridBagConstraints(3, 8, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
			}
			{
				lblQualification = new JLabel();
				jPanel1.add(lblQualification, new GridBagConstraints(1, 10, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
				lblQualification.setText(setFieldLabel(getResources().getString("dialog_label_staff_qualfcation"), true));
			}
			{
				txtFldQualification = new VISTextField();
				jPanel1.add(txtFldQualification, new GridBagConstraints(3, 10, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
			}
			{
				lblDesignation = new JLabel();
				jPanel1.add(lblDesignation, new GridBagConstraints(1, 12, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
				lblDesignation.setText(setFieldLabel(getResources().getString("dialog_label_staff_designation"), true));
			}
			{
				
				txtFldDesignaton = new VISTextField();
				jPanel1.add(txtFldDesignaton, new GridBagConstraints(3, 12, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
			}
			{
				lblDateOfJoin = new JLabel();
				jPanel1.add(lblDateOfJoin, new GridBagConstraints(1, 16, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
				lblDateOfJoin.setText(setFieldLabel(getResources().getString("dialog_label_staff_dofjoin"), true));
			}
			{
				//txtFldDateOfJoin = new VISTextField();
				//JDateChooser dtChoDateOfJoin = new JDateChooser()
				dtChoDateOfJoin=new JDateChooser(null,DBConstants.DISPLAY_DATE_FORMAT);
				dtChoDateOfJoin.setPreferredSize(txtFldDesignaton.getPreferredSize());
				jPanel1.add(dtChoDateOfJoin, new GridBagConstraints(3, 16, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
			}
			{
				lblVillage = new JLabel();
				jPanel1.add(lblVillage, new GridBagConstraints(1, 18, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
				lblVillage.setText(setFieldLabel(getResources().getString("dialog_label_staff_village"), false));
			}
			{
				txtFldVillage = new VISTextField();
				jPanel1.add(txtFldVillage, new GridBagConstraints(3, 18, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
			}
			{
				lblMandal = new JLabel();
				jPanel1.add(lblMandal, new GridBagConstraints(1, 20, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
				lblMandal.setText(setFieldLabel(getResources().getString("dialog_label_staff_mandal"), false));
			}
			{
				txtFldMandal = new VISTextField();
				jPanel1.add(txtFldMandal, new GridBagConstraints(3, 20, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
			}
			{
				lblDistrict = new JLabel();
				jPanel1.add(lblDistrict, new GridBagConstraints(1, 22, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
				lblDistrict.setText(setFieldLabel(getResources().getString("dialog_label_staff_dstrict"), false));
			}
			{
				txtFldDistrict = new VISTextField();
				jPanel1.add(txtFldDistrict, new GridBagConstraints(3, 22, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
			}
			
			{
				
				visComBoxModel = new VISComboBoxModel();
				visComBoxModel.setData(Util.getEmployeeType());
				visComBoxModel.setSelectedKey(DBConstants.HEADER_DEFAULT_KEY);
				combxEmployeeType = new JComboBox();
				combxEmployeeType.setPreferredSize(txtFldDistrict.getPreferredSize());
				jPanel1.add(combxEmployeeType, new GridBagConstraints(3, 14, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
				combxEmployeeType.setModel(visComBoxModel);
			}
			{
				lblEmpType = new JLabel();
				jPanel1.add(lblEmpType, new GridBagConstraints(1, 14, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 20, 0, 0), 0, 0));
				lblEmpType.setText(setFieldLabel(getResources().getString("dialog_label_staff_emptype"), true));
			}
			{
				pnlMessage = new JPanel();
				GridBagLayout jPanelLayout = new GridBagLayout();
				jPanel1.add(pnlMessage, new GridBagConstraints(1, 1, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
				jPanelLayout.rowWeights = new double[] {0.1};
				jPanelLayout.rowHeights = new int[] {7};
				jPanelLayout.columnWeights = new double[] {0.1};
				jPanelLayout.columnWidths = new int[] {7};
				pnlMessage.setLayout(jPanelLayout);
			}

		}

		
	
		
	}
	public JPanel getjPanel1() {
		return pnlMessage;
	}

	/**
	 * @return the jPanel1
	 */
	public JPanel getJPanel1() {
		return jPanel1;
	}

	/**
	 * @param panel1 the jPanel1 to set
	 */
	public void setJPanel1(JPanel panel1) {
		jPanel1 = panel1;
	}

	/**
	 * @return the btnSave
	 */
	public JButton getBtnSave() {
		return btnSave;
	}

	/**
	 * @param btnSave the btnSave to set
	 */
	public void setBtnSave(JButton btnSave) {
		this.btnSave = btnSave;
	}

	/**
	 * @return the txtFldFatherName
	 */
	public VISTextField getTxtFldFatherName() {
		return txtFldFatherName;
	}

	/**
	 * @param txtFldFatherName the txtFldFatherName to set
	 */
	public void setTxtFldFatherName(VISTextField txtFldFatherName) {
		this.txtFldFatherName = txtFldFatherName;
	}

	/**
	 * @return the txtFldDOB
	 */
	public VISTextField getTxtFldDOB() {
		return txtFldDOB;
	}

	/**
	 * @param txtFldDOB the txtFldDOB to set
	 */
	public void setTxtFldDOB(VISTextField txtFldDOB) {
		this.txtFldDOB = txtFldDOB;
	}

	/**
	 * @return the lblDateOfBirth
	 */
	public JLabel getLblDateOfBirth() {
		return lblDateOfBirth;
	}

	/**
	 * @param lblDateOfBirth the lblDateOfBirth to set
	 */
	public void setLblDateOfBirth(JLabel lblDateOfBirth) {
		this.lblDateOfBirth = lblDateOfBirth;
	}

	/**
	 * @return the lblQualification
	 */
	public JLabel getLblQualification() {
		return lblQualification;
	}

	/**
	 * @param lblQualification the lblQualification to set
	 */
	public void setLblQualification(JLabel lblQualification) {
		this.lblQualification = lblQualification;
	}

	/**
	 * @return the txtFldDistrict
	 */
	public VISTextField getTxtFldDistrict() {
		return txtFldDistrict;
	}

	/**
	 * @param txtFldDistrict the txtFldDistrict to set
	 */
	public void setTxtFldDistrict(VISTextField txtFldDistrict) {
		this.txtFldDistrict = txtFldDistrict;
	}

	/**
	 * @return the lblEmpType
	 */
	public JLabel getLblEmpType() {
		return lblEmpType;
	}

	/**
	 * @param lblEmpType the lblEmpType to set
	 */
	public void setLblEmpType(JLabel lblEmpType) {
		this.lblEmpType = lblEmpType;
	}

	/**
	 * @return the pnlMessage
	 */
	public JPanel getPnlMessage() {
		return pnlMessage;
	}

	/**
	 * @param pnlMessage the pnlMessage to set
	 */
	public void setPnlMessage(JPanel pnlMessage) {
		this.pnlMessage = pnlMessage;
	}

	/**
	 * @return the combxEmployeeType
	 */
	public JComboBox getCombxEmployeeType() {
		return combxEmployeeType;
	}

	/**
	 * @param combxEmployeeType the combxEmployeeType to set
	 */
	public void setCombxEmployeeType(JComboBox combxEmployeeType) {
		this.combxEmployeeType = combxEmployeeType;
	}

	/**
	 * @return the txtFldMandal
	 */
	public VISTextField getTxtFldMandal() {
		return txtFldMandal;
	}

	/**
	 * @param txtFldMandal the txtFldMandal to set
	 */
	public void setTxtFldMandal(VISTextField txtFldMandal) {
		this.txtFldMandal = txtFldMandal;
	}

	/**
	 * @return the lblDistrict
	 */
	public JLabel getLblDistrict() {
		return lblDistrict;
	}

	public JDateChooser getDtChoDateOfJoin() {
		return dtChoDateOfJoin;
	}

	public void setDtChoDateOfJoin(JDateChooser dtChoDateOfJoin) {
		this.dtChoDateOfJoin = dtChoDateOfJoin;
	}

	/**
	 * @param lblDistrict the lblDistrict to set
	 */
	public void setLblDistrict(JLabel lblDistrict) {
		this.lblDistrict = lblDistrict;
	}

	/**
	 * @return the txtFldVillage
	 */
	public VISTextField getTxtFldVillage() {
		return txtFldVillage;
	}

	/**
	 * @param txtFldVillage the txtFldVillage to set
	 */
	public void setTxtFldVillage(VISTextField txtFldVillage) {
		this.txtFldVillage = txtFldVillage;
	}

	/**
	 * @return the lblMandal
	 */
	public JLabel getLblMandal() {
		return lblMandal;
	}

	/**
	 * @param lblMandal the lblMandal to set
	 */
	public void setLblMandal(JLabel lblMandal) {
		this.lblMandal = lblMandal;
	}

	
	/**
	 * @return the lblVillage
	 */
	public JLabel getLblVillage() {
		return lblVillage;
	}

	/**
	 * @param lblVillage the lblVillage to set
	 */
	public void setLblVillage(JLabel lblVillage) {
		this.lblVillage = lblVillage;
	}

	/**
	 * @return the txtFldDesignaton
	 */
	public VISTextField getTxtFldDesignaton() {
		return txtFldDesignaton;
	}

	/**
	 * @param txtFldDesignaton the txtFldDesignaton to set
	 */
	public void setTxtFldDesignaton(VISTextField txtFldDesignaton) {
		this.txtFldDesignaton = txtFldDesignaton;
	}

	/**
	 * @return the lblDateOfJoin
	 */
	public JLabel getLblDateOfJoin() {
		return lblDateOfJoin;
	}

	/**
	 * @param lblDateOfJoin the lblDateOfJoin to set
	 */
	public void setLblDateOfJoin(JLabel lblDateOfJoin) {
		this.lblDateOfJoin = lblDateOfJoin;
	}

	/**
	 * @return the lblDesignation
	 */
	public JLabel getLblDesignation() {
		return lblDesignation;
	}

	/**
	 * @param lblDesignation the lblDesignation to set
	 */
	public void setLblDesignation(JLabel lblDesignation) {
		this.lblDesignation = lblDesignation;
	}

	/**
	 * @return the txtFldQualification
	 */
	public VISTextField getTxtFldQualification() {
		return txtFldQualification;
	}

	/**
	 * @param txtFldQualification the txtFldQualification to set
	 */
	public void setTxtFldQualification(VISTextField txtFldQualification) {
		this.txtFldQualification = txtFldQualification;
	}

	/**
	 * @return the lblFatherName
	 */
	public JLabel getLblFatherName() {
		return lblFatherName;
	}

	/**
	 * @param lblFatherName the lblFatherName to set
	 */
	public void setLblFatherName(JLabel lblFatherName) {
		this.lblFatherName = lblFatherName;
	}

	/**
	 * @return the txtFldName
	 */
	public VISTextField getTxtFldName() {
		return txtFldName;
	}

	/**
	 * @param txtFldName the txtFldName to set
	 */
	public void setTxtFldName(VISTextField txtFldName) {
		this.txtFldName = txtFldName;
	}

	/**
	 * @return the txtFldCode
	 */
	public VISTextField getTxtFldCode() {
		return txtFldCode;
	}

	/**
	 * @param txtFldCode the txtFldCode to set
	 */
	public void setTxtFldCode(VISTextField txtFldCode) {
		this.txtFldCode = txtFldCode;
	}

	/**
	 * @return the btnReset
	 */
	public JButton getBtnReset() {
		return btnReset;
	}

	/**
	 * @param btnReset the btnReset to set
	 */
	public void setBtnReset(JButton btnReset) {
		this.btnReset = btnReset;
	}

	/**
	 * @return the btnStaffPanel
	 */
	public JPanel getBtnStaffPanel() {
		return btnStaffPanel;
	}

	/**
	 * @param btnStaffPanel the btnStaffPanel to set
	 */
	public void setBtnStaffPanel(JPanel btnStaffPanel) {
		this.btnStaffPanel = btnStaffPanel;
	}

	/**
	 * @return the lblName
	 */
	public JLabel getLblName() {
		return lblName;
	}

	/**
	 * @param lblName the lblName to set
	 */
	public void setLblName(JLabel lblName) {
		this.lblName = lblName;
	}

	/**
	 * @return the lblCode
	 */
	public JLabel getLblCode() {
		return lblCode;
	}

	/**
	 * @param lblCode the lblCode to set
	 */
	public void setLblCode(JLabel lblCode) {
		this.lblCode = lblCode;
	}
	
	
	public VISComboBoxModel getVisComBoxModel() {
		return visComBoxModel;
	}

	/**
	 * @return the dtChoDateOfBirth
	 */
	public JDateChooser getDtChoDateOfBirth() {
		return dtChoDateOfBirth;
	}

	/**
	 * @param dtChoDateOfBirth the dtChoDateOfBirth to set
	 */
	public void setDtChoDateOfBirth(JDateChooser dtChoDateOfBirth) {
		this.dtChoDateOfBirth = dtChoDateOfBirth;
	}

	/**
	 * @return the hidnObject
	 */
	public Object getHidnObject() {
		return hidnObject;
	}

	/**
	 * @param hidnObject the hidnObject to set
	 */
	public void setHidnObject(Object hidnObject) {
		this.hidnObject = hidnObject;
	}

	/**
	 * @return the searchText
	 */
	public String getSearchText() {
		return searchText;
	}

	/**
	 * @param searchText the searchText to set
	 */
	public void setSearchText(String searchText) {
		this.searchText = searchText;
	}

	
}
